<!DOCTYPE HTML>

<html manifest="zlizer.manifest">
<head>
	<title>Zlizer</title>
    <script type="text/javascript">
        document.write('<link rel="apple-touch-startup-image" href="assets/startup'+(navigator.platform=='iPad'?'_ipad':'')+'.jpg">');
    </script>
    <link rel="apple-touch-icon" href="assets/icon.png"/>
	<style>
	body {
	background:-webkit-gradient(radial, 50% 50%, 10, 50% 50%, 850, from(#93d81e), to(#2f5c1b), color-stop(.6,#5ea71d));
	background: -moz-radial-gradient(center 45deg, circle farthest-side, #93d81e 0%, #5ea71d 60%, #2f5c1b 100%);

	}
	</style>
</head>
<body>
   	<script type="text/javascript">
		(function(name,callback){

			var getObjectByName = function(name, opt_obj) {
				var parts = name.split('.');
				var cur = opt_obj || window;
				for (var part; part = parts.shift(); ) {
					if (cur[part]) {
						cur = cur[part];
					} else {
						return null;
					}
				}
				return cur;
			};

			function loadJS(call){
				var script = document.createElement('script');
				script.setAttribute('type','text/javascript');
				script.onload = function(){
					(getObjectByName(callback))();
					call();
				};

				script.setAttribute('src',name);
				document.getElementsByTagName('head')[0].appendChild(script);
			}

			var webappCache = window.applicationCache;

			if(webappCache && window.navigator.userAgent.indexOf('WebKit') != -1){

				var WIDTH = 200,
					HEIGHT = 100;

				var scripts = document.getElementsByTagName('script');
				var script = scripts[scripts.length-1];
				var el = document.createElement('div');
				var parent = script.parentNode;
				if(parent.style.position!='absolute' && parent.style.position!='relative'){
					parent.style.cssText = 'relative';
				}
				var pwidth = window.innerWidth;
				var pheight = window.innerHeight;
				el.style.cssText = 'text-align:center;width:'+WIDTH+'px;height:'+HEIGHT+'px;position:absolute;left:'+Math.round((pwidth-WIDTH)*.5)+'px;top:'+Math.round((pheight-HEIGHT)*.5)+'px';
				script.parentNode.insertBefore(el,script);
				script.parentNode.removeChild(script);

				var started = 0;

				var close = function(){
					if(started) return;
					el.innerHTML = 'Starting';
					loadJS(function(){
						el.parentNode.removeChild(el);
					});
					started=1;
					clearTimeout(timeout);
				};

				var timeout = setTimeout(function(){close()},6000);

				webappCache.addEventListener('checking', function(){
					//console.log('checking');
					el.innerHTML = 'Initializing';
					},false);

				webappCache.addEventListener('cached', function(){
					//console.log('cached');
					close();
				},false);

				webappCache.addEventListener('noupdate', function(){
					//console.log('noupdate');
					close();
				},false);

				webappCache.addEventListener('updateready', function(){
					//console.log('updateready');
					webappCache.swapCache();
					close();
				},false);
/*
			webappCache.addEventListener('downloading', function(){
					clearTimeout(timeout);
				},false);

				webappCache.addEventListener('progress', function(e){
					console.log('progress '+e.loaded+'/'+e.total);
					el.innerHTML = 'Loading '+e.loaded+'/'+e.total;
				},false);
*/
				webappCache.addEventListener('obsolete', function(){
					//console.log('obsolete')
					close();
				}, false);

				webappCache.addEventListener('error', function(e){
					//console.log('error');
					close();
				}, false);
			}
			else {
				loadJS(function(){});
			}

		})('zlizer.js','zlizer.start');

		</script>
</body>

</html>
